package com.peng.aidlserver.service;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.support.annotation.Nullable;
import android.util.Log;

import com.peng.common.IAidlInterface;


/**
 * Created by Mr.Q on 2017/6/28.
 * 描述
 */

public class SsoAuthService extends Service {

    private static final String TAG = "SsoAuthService";

    SsoImpl mBinder = new SsoImpl();

    @Override
    public void onCreate() {
        super.onCreate();
        Log.d(TAG, "onCreate: SsoAuthService");
    }

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return mBinder;
    }

    /**
     * 完成实际的功能，Service只是提供一个依附的外壳
     */
    class SsoImpl extends IAidlInterface.Stub {

        @Override
        public void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat, double aDouble, String aString) throws RemoteException {

        }

        @Override
        public String ssoAuth(String userName, String password) throws RemoteException {
            Log.d(TAG, "basicTypes: SsoAuthService" + "userName:" + userName + "password:" + password);
            return "Service 成功";
        }
    }

}
